home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / pvm34b3.zip / pvm34b3 / pvm3 / src / OS2 / os2src / os2spawn.c < prev    next >
C/C++ Source or Header  |  1997-08-08  |  775b  |  29 lines

  1. #include<process.h>
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4.  
  5. int os2_spawn( char *path, char **argv, int nenv, char **env, 
  6.                char *debugger)
  7. //-----------------------------------------------------------
  8.  { char *Arg[1024],*Env[1024],**d,**s,*idstr="PVMEPID=",buf[32];
  9.  
  10.    sprintf(buf,"%s%i",idstr,0);
  11.  
  12.    d=Arg; s=argv;
  13.    if (debugger) { *d = getenv("PVM_DEBUGGER");
  14.                    if(*d==0)*d=debugger;
  15.                    d++;
  16.                   }
  17.    *d++=path; s++; while(*s)*d++=*s++; *d=0;
  18.  
  19.    d=Env; s=environ; 
  20.    while(*s) { if(strncmp(*s,idstr,strlen(idstr)))*d++=*s;
  21.                else  *d++=buf;
  22.                s++; 
  23.              }
  24.    s=env; while(nenv--)*d++=*s++;  *d=0;
  25.  
  26.    return spawnve(P_NOWAIT,path,Arg,Env);
  27.  }
  28.  
  29.